﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AudioDemo.View
{
    /// <summary>
    /// convert2.xaml 的交互逻辑
    /// </summary>
    public partial class convert2 : Window
    {
        public convert2()
        {
            InitializeComponent();
        }
    }
public class ColorConverter : IMultiValueConverter
{
    //正向修改
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        if (values == null || values.Length < 2)
            return DependencyProperty.UnsetValue;
        double verValue = (double)values[0];
        double horValue = (double)values[1];
        if (verValue > horValue)
            return new SolidColorBrush(Colors.Green);
        else if (verValue < horValue)
            return new SolidColorBrush(Colors.Red);
        return new SolidColorBrush(Colors.Yellow);
    }
    //反向修改
    public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        //返回空，标记不可双向转换
        return null;
    }
}
}
